﻿using Microsoft.Phone.Info;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace MoMoTransferVN_WP.utils
{
    class DevicesUtils
    {
        public static String getImei()
        {
            byte[] uniqueIDbytes = (byte[]) DeviceExtendedProperties.GetValue("DeviceUniqueId");
            string uniqueID = System.Convert.ToBase64String(uniqueIDbytes);
            if (uniqueID != null)
                return uniqueID;
            else
                return "";
        }

        public static string GetAppVersion()
        {
            var xmlReaderSettings = new XmlReaderSettings
            {
                XmlResolver = new XmlXapResolver()
            };

            using (var xmlReader = XmlReader.Create("WMAppManifest.xml", xmlReaderSettings))
            {
                xmlReader.ReadToDescendant("App");

                return xmlReader.GetAttribute("Version");
            }
        }

    }
}
